package com.bw.controller;

import com.bw.entity.User;
import com.bw.entity.Zxt;
import com.bw.mapper.OrderInfoMapper;
import com.bw.mapper.UserMapper;
import org.spring.kun.common.ExcelUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller
public class EchartsController {

    @Autowired
    OrderInfoMapper orderInfoMapper;
    @Autowired
    UserMapper userMapper;

    @RequestMapping("/tu.do")
    public String tu(){

        return "tu";
    }

    @RequestMapping("/zxt.do")
    @ResponseBody
    public List<Zxt> zxt(String productNum){

        return  orderInfoMapper.zxt(productNum);
    }

    @RequestMapping("/excel.do")
    public void excel(String productNum, HttpServletResponse response){

        List<Zxt> zxt = orderInfoMapper.zxt(productNum);

        ExcelUtils.exportExcel(zxt,"币种金额导出","sheet1",response);
    }

}
